package view;

import java.awt.Container;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

import org.havi.ui.HContainer;
import org.havi.ui.event.HRcEvent;

import components.Form;

public class DynamicRender extends HContainer implements KeyListener {

    private final MainMenu mainMenu;

    private final Render render;

    private Container panel;

    private final Form form;

    public DynamicRender(int i, int j, int k, int l, MainMenu mainMenu, Form form) {
        this.form = form;
        this.mainMenu = mainMenu;
        render = new Render();
        this.addKeyListener(this);
        Componentes();
        this.add(panel);
        panel.repaint();
        repaint();
    }

    private void Componentes() {
        panel = render.renderForm(form);
    }

    public void keyPressed(KeyEvent e) {
        if (e.getKeyChar() == HRcEvent.VK_ESCAPE) {
            mainMenu.removePanelScene(this);
        }
        if (false) {
            mainMenu.closeFunctionForm(DynamicRender.this);
        }
    }

    public void keyReleased(KeyEvent e) {
    // TODO Auto-generated method stub

    }

    public void keyTyped(KeyEvent e) {
    // TODO Auto-generated method stub

    }

}
